import { http } from '@/utils/http/axios';

// 查询组织列表
export function getOrganizationList(data = {}) {
  return http.request({
    url: '/crm/orgnization/page',
    method: 'post',
    data,
  });
}

// 获取组织下拉树列表
export function getOrgTreeSelect() {
  return http.request({
    url: '/crm/orgnization/orgtree',
  });
}

// 获取组织下拉树列表(新增组织和用户时)
export function getUserOrgTree() {
  return http.request({
    url: '/crm/orgnization/getUserOrgTree',
  });
}

// 获取与用户有关联的层级为1的组织(客户，供应商，产品资料，物料资料页面使用)
export function getOrgHierarchy() {
  return http.request({
    url: '/crm/orgnization/getOrgHierarchy',
    method: 'get',
  });
}

// 新增组织信息表记录
export function createOrgnization(data) {
  return http.request({
    url: '/crm/orgnization/create',
    method: 'post',
    data,
  });
}

// 修改组织信息表记录
export function updateOrgnization(data) {
  return http.request({
    url: '/crm/orgnization/update',
    method: 'put',
    data,
  });
}

// 组织信息表详情
export function getOrgnization(data) {
  return http.request({
    url: '/crm/orgnization/get',
    params: data,
  });
}

// 物理删除组织信息表记录
export function deleteOrgnization(data) {
  return http.request({
    url: '/crm/orgnization/remove',
    method: 'delete',
    params: data,
  });
}
